/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-11-01
 * Time: 19:07
 */
public class test_1 {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     *
     * @param param string字符串
     * @return string字符串
     */
    public  static String compressString (String param) {
        // write code here
        StringBuffer sb = new StringBuffer();
        int flag=1;
        int len=0;
        for (char c : param.toCharArray()) {
            if (c!=flag){
                if (len>1){
                    sb.append(len);
                }
                sb.append(c);
                flag=c;
                len=1;
            }else {
                len++;
            }
        }
        if (len>1){
            sb.append(len);
        }

        return sb.toString();
    }

    public static void main(String[] args) {
        System.out.println(compressString("shopeew"));

    }
}
